home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 December / Australian PC User - December 2003 (CD2).iso / software / apps / files / dwmx2k4.exe / Disk1 / data1.cab / Configuration_En / Objects / Server / DynamicSelect.js < prev    next >
Encoding:
JavaScript  |  2003-09-05  |  4.4 KB  |  160 lines

  1. // Copyright 2001, 2002, 2003 Macromedia, Inc. All rights reserved.
  2.  
  3. // *************** GLOBALS VARS *****************
  4.  
  5. // ******************* API **********************
  6.  
  7. //--------------------------------------------------------------------
  8. // FUNCTION:
  9. //   objectTag
  10. //
  11. // DESCRIPTION:
  12. //   This object is used as a shim to launch the appropriate 
  13. //   server behavior for the current server model.  The individual
  14. //   server behavior files are responsible for inserting the code on the
  15. //   page, so this function just returns the empty string.
  16. //
  17. // ARGUMENTS:
  18. //   none
  19. //
  20. // RETURNS:
  21. //   string - empty string to indicate that nothing should be inserted
  22. //--------------------------------------------------------------------
  23.  
  24. function objectTag() 
  25. {
  26.   var dom = dw.getDocumentDOM();
  27.   
  28.   if (dom)
  29.   {
  30.     var serverModel = dom.serverModel.getFolderName();
  31.     
  32.     if (serverModel)
  33.     {    
  34.       var serverBehaviorFile = "";
  35.  
  36.       switch (serverModel)
  37.       {
  38.       case "ASP_VBS":
  39.       case "ASP_JS":
  40.       case "ColdFusion":
  41.       case "JSP":
  42.       case "PHP_MySQL":
  43.         serverBehaviorFile = "DynamicSelectList.htm";
  44.         break;
  45.  
  46.       case "ASP.NET_Csharp":
  47.       case "ASP.NET_VB":
  48.         // not supported
  49.         break;
  50.  
  51.       default:
  52.         // We will launch a server behavior with a default name
  53.         // so that live objects can be implemented
  54.         // for third party server models.
  55.  
  56.         serverBehaviorFile = "DynamicSelectList.htm";        
  57.         break;
  58.       } 
  59.  
  60.       if (serverBehaviorFile && canInsertServerObject(serverBehaviorFile))
  61.       {
  62.         dw.popupServerBehavior(serverBehaviorFile);
  63.       }
  64.     }
  65.     else
  66.     {
  67.       alert(MM.MSG_NeedServerModelForSO);
  68.     }
  69.   }
  70.   
  71.   return "";  
  72. }
  73.  
  74.  
  75. //--------------------------------------------------------------------
  76. // FUNCTION:
  77. //   canInsertServerObject
  78. //
  79. // DESCRIPTION:
  80. //   The function returns true if this object can be inserted in the
  81. //   current document.  This function, and the functions it calls should
  82. //   display the necessary error messages.
  83. //
  84. // ARGUMENTS:
  85. //   sbFileName - string - the file name of the server behavior file
  86. //     which implements this object
  87. //
  88. // RETURNS:
  89. //   boolean - true if the dialog should be displayed, or false otherwise
  90. //--------------------------------------------------------------------
  91.  
  92. function canInsertServerObject(sbFileName)
  93. {
  94.   var retVal = true;
  95.  
  96.   var curDom = dw.getDocumentDOM();
  97.   var serverModel = (curDom) ? curDom.serverModel.getFolderName() : "";
  98.   var path = dw.getConfigurationPath() + "/ServerBehaviors/" + serverModel
  99.            + "/" + sbFileName;
  100.            
  101.   if (!dwscripts.fileExists(path))
  102.   {
  103.     var err = dwscripts.sprintf(MM.MSG_NeedCommandFileForSO, path);
  104.     retVal = false;
  105.     alert(err);
  106.   }
  107.   
  108.   return retVal;
  109. }
  110.  
  111. //--------------------------------------------------------------------
  112. // FUNCTION:
  113. //   getSetupSteps
  114. //
  115. // DESCRIPTION:
  116. //   Returns an array of steps to be displayed in an instructions
  117. //   dialog.  The first element of the array is the text that appears
  118. //   above the list.  The remaining elements are the steps, which will
  119. //   be rendered in a numbered list.
  120. //
  121. //   The steps are each HTML, which may contain JavaScript event
  122. //   handlers.  The event handlers can either be a JavaScript script
  123. //   or an "event:KeyWord" syntax.  If the latter is used, then the
  124. //   handler for KeyWord is implemented internally in the Dreamweaver
  125. //   executable.
  126. //
  127. // ARGUMENTS:
  128. //   none
  129. //
  130. // RETURNS:
  131. //   the array described above
  132. //--------------------------------------------------------------------
  133. function getSetupSteps()
  134. {
  135.   return getSetupStepsForServerObject();
  136. }
  137.  
  138.  
  139.  
  140. //--------------------------------------------------------------------
  141. // FUNCTION:
  142. //   setupStepsCompleted
  143. //
  144. // DESCRIPTION:
  145. //   Returns the number of steps (in the list of steps returned from
  146. //   getSetupSteps) that have already been completed.  This number is
  147. //   used to determine how many steps will have a check mark next to
  148. //   them.
  149. //
  150. // ARGUMENTS:
  151. //   none
  152. //
  153. // RETURNS:
  154. //   An integer - the number of check marks to be displayed, or -1
  155. //   if all steps have been completed.
  156. //--------------------------------------------------------------------
  157. function setupStepsCompleted()
  158. {
  159.   return setupStepsCompletedForServerObject();
  160. }